package org.beaconframework.ext.ibm.wps.data;


import org.beaconframework.vaadin.util.VaadinContext;

import org.beaconframework.ext.rs.*;
public abstract class QueryTemplateBase extends JsonToXmlQueryTemplate {

	String WebResourceFactoryBeanName;
	
	public void setWebResourceFactoryBeanName(String s) {
		WebResourceFactoryBeanName = s;
	}

	@Override
	public WebResourceFactory getWebResourceFactory() {
		WebResourceFactory wcf = super.getWebResourceFactory();

		if (wcf==null && WebResourceFactoryBeanName!=null) {
			wcf = VaadinContext.getApplicationContext().getBean(WebResourceFactoryBeanName,WebResourceFactory.class);
		}
		
		if (wcf==null) {
			throw new NullPointerException("getWebResourceFactory() cannot return null");
		}
		return wcf;
	}


	
}
